package com.example.androidframework.ui.mall.holder

import android.view.View
import com.bumptech.glide.Glide
import com.example.androidframework.R
import com.example.androidframework.databinding.ItemMallScoreGoodsBinding
import com.martin.lib_base.annotation.ItemData
import com.martin.lib_base.base.BaseViewHolder
import com.martin.lib_base.bean.app.mall.BdGoodsBean
import com.martin.lib_base.interfaces.IItemData
import com.martin.lib_base.ktx.loge

@ItemData(ScoreGoodsViewHolder.Companion.ItemData::class)
class ScoreGoodsViewHolder(view: View) : BaseViewHolder<BdGoodsBean, ItemMallScoreGoodsBinding>(view) {
    override fun onBindViewHolder(position: Int, item: Any?) {
        val bean: BdGoodsBean? = getItemBean(item)
        bean?.let {
            Glide.with(itemView).load(it.thumb).into(binding.image)
            binding.title.text = it.present_price

            itemView.setOnClickListener { item ->
                loge("点击积分专区 : ${it.name}")
            }
        }
    }

    companion object {
        class ItemData: IItemData {
            override fun getItemLayoutId(): Int = R.layout.item_mall_score_goods
        }
    }
}